package vn.com.shoppie.sobjmng;

import android.annotation.SuppressLint;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

import com.hoasua.adb.adbSqlHelper;

public class SDataBaseHelper extends adbSqlHelper {

	@SuppressLint("SdCardPath")
	private static String DB_PATH = "/data/data/vn.com.shoppie.activity/databases/";

	private static String DB_NAME = "shoppie.sqlite";

	public SDataBaseHelper(Context context) {
		super(context, DB_PATH, DB_NAME);
	}

	@Override
	public void createAdb(SQLiteDatabase db) {
		db.execSQL(getSql(CampaignMng.TABLE,CampaignMng.COLUMNS));
		db.execSQL(getSql(GiftMng.TABLE,GiftMng.COLUMNS));
		db.execSQL(getSql(ImageMng.TABLE,ImageMng.COLUMNS));
		db.execSQL(getSql(ProductMng.TABLE,ProductMng.COLUMNS));
		db.execSQL(getSql(ShopMng.TABLE,ShopMng.COLUMNS));
		db.execSQL(getSql(StoreMng.TABLE,StoreMng.COLUMNS));
		db.execSQL(getSql(UserMng.TABLE,UserMng.COLUMNS));
		db.execSQL(getSql(LinkMng.TABLE,LinkMng.COLUMNS));
		db.execSQL(getSql(MerchantMng.TABLE,MerchantMng.COLUMNS));
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXIST " + CampaignMng.TABLE);
		db.execSQL("DROP TABLE IF EXIST " + GiftMng.TABLE);
		db.execSQL("DROP TABLE IF EXIST " + ImageMng.TABLE);
		db.execSQL("DROP TABLE IF EXIST " + ProductMng.TABLE);
		db.execSQL("DROP TABLE IF EXIST " + ShopMng.TABLE);
		db.execSQL("DROP TABLE IF EXIST " + StoreMng.TABLE);
		db.execSQL("DROP TABLE IF EXIST " + UserMng.TABLE);
		db.execSQL("DROP TABLE IF EXIST " + LinkMng.TABLE);
		db.execSQL("DROP TABLE IF EXIST " + MerchantMng.TABLE);
	}

}
